<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function Person(name, age) {
            this.name = name;
            this.age = age;
            this.run = function () {
                console.log(this.name + '在奔跑');
            }
        }
        var p1 = new Person('张三', 20);  // 创建实例化对象
        console.log(p1.name);  // 用实例化对象访问name属性
        p1.run();  // 用实例化对象访问run方法
        console.log(Person.name);  // 无法访问
    </script>

</body>

</html>